import org.newdawn.slick.*;

/**
 * Write a description of class AnimationData here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class SpriteSheetInfo
{
    private SpriteSheet spriteSheet;
    private String strSheetName;

    /**
     * Constructs the ImageData instance
     */
    public SpriteSheetInfo(SpriteSheet _sheet, String _strSheetName)
    {
        strSheetName = _strSheetName;
        spriteSheet = _sheet;
    } //End constructor

    /**
     * Returns the sprite sheet name
     * @pre None
     * @param None
     * @return The name of this sprite sheet
     * @post None
     */
    public String getName()
    {
        return strSheetName;
    } //End getName method

    /**
     * Returns the sprite sheet
     * @pre None
     * @param None
     * @return The sprite sheet
     * @post None
     */
    public SpriteSheet getSpriteSheet()
    {
        return spriteSheet;
    } //End getImage method
    
    /**
     * Creates an animation using the sprite sheet.
     * @pre None
     * @param sheet The sprite sheet
     * @param duration How long each frame lasts
     * @return The animation
     * @post None
     */
    public static Animation createAnimation(SpriteSheet sheet, int duration)
    {
        return new Animation(sheet, duration);
    } //End createAnimation method
    
    /**
     * Creates and returns a flipped animation
     * @pre None
     * @param sheet The sprite sheet
     * @param duration How long each frame lasts
     * @return The new animation
     * @post None
     */
    public static Animation createFlippedAnimation(SpriteSheet sheet, int duration)
    {
        Image[] images = new Image[sheet.getHorizontalCount()];
        
        for(int i = 0; i < sheet.getHorizontalCount(); i++)
        {
            images[i] = sheet.getSubImage(i, 0).getFlippedCopy(true, false);
        } //End for loop
        
        return new Animation(images, duration);
    } //End getFlippedAnimation method
} //End class
